<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="edit-card">
    <h1>修改文章 - ${article.title}</h1>
    <form id="dataForm">
        <input type="hidden" value="${article.id}" name="id">
        <input type="hidden" value="${article.img}" name="img" id="img">
        <table>
            <tr>
                <td>标题</td>
                <td class="ta-left">
                    <input type="text" class="wpx300 sm" value="${article.title}" name="title">
                </td>
            </tr>
            <tr>
                <td>内容</td>
                <td class="ta-left">
                    <%--<textarea name="content">${article.content}</textarea>--%>
                    <!-- 加载编辑器的容器 -->
                    <script id="container" name="content" type="text/plain">${article.content}</script>
                </td>
            </tr>
            <tr>
                <td>图片</td>
                <td class="ta-left">
                    <div>
                        <input type="file" name="image" id="imgFile">
                    </div>
                    <div class="mtpx20">
                        <c:if test="${!empty article.img}">
                            <img class="img" src="${imageServer}${article.img}" id="imgUrl">
                        </c:if>
                        <c:if test="${empty article.img}">
                            <img class="img hide" id="imgUrl">
                        </c:if>
                    </div>
                </td>
            </tr>
            <tr>
                <td></td>
                <td class="ta-left">
                    <input type="button" value="提交" id="articleUpdSave" class="sm">
                    <input type="button" value="返回" id="back" class="sm">
                </td>
            </tr>
        </table>
    </form>
</div>
<script>
    $("#articleUpdSave").on("click", function () {
        ajaxArticleUpd();
    });
    $("#back").on("click", function () {
        articleList();
    });
    $("#imgFile").on("change", function () {
        uploadImg();
    });
</script>